package cmd

import (
	"colly/services"
	"github.com/spf13/cobra"
)

func init() {
	runDir, _ = getExecutableDir()
	nbaCmd.PersistentFlags().StringVarP(&proxyFile, "proxy", "p", runDir+"/clash.yaml", "clash file path")
	rootCmd.AddCommand(nbaCmd)
}

var nbaCmd = &cobra.Command{
	Use:   "nba",
	Short: "This is the gold command",
	Long:  "This is the gold command",
	PreRun: func(cmd *cobra.Command, args []string) {
		if proxyFile == "" {
			proxyFile = "./clash.yaml"
		}
	},
	Run: func(cmd *cobra.Command, args []string) {
		services.Nba("https://www.2kratings.com/current-teams", proxyFile, Db, Log)
		//services.NbaPlayerInfo("https://www.2kratings.com/teams/atlanta-hawks", proxyFile, Db, Log)
	},
}
